<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- <script src="http://img.mukewang.com/down/540812440001e40e00000000.js" type="text/javascript"></script> -->
<script type="text/javascript" src="../jquery-2.1.1.js"></script>
<style type="text/css">
	div{
		width: 30px;
		height: 10px;
		float:left;
	}
</style>
<title>无标题文档</title>


<button id="test1">jQuey[0]</button>
<button id="test2">jQuey.get</button>
<button id="test3">aQuery[0]</button>
<button id="test4">aQuery.get</button>

<p id="book">book</p>

<div id="show1"></div>
<div id="show2"></div>
<div id="show3"></div>
<div id="show4"></div>

<script type="text/javascript">

var aQuery = function(selector) {
    //强制为对象
	if (!(this instanceof aQuery)) {
		return new aQuery(selector);
	}
	var elem = document.getElementById(/[^#].*/.exec(selector)[0]);
	this.length = 1;
	this[0] = elem;
	this.context = document;
	this.selector = selector;
	this.get = function(num) {
		return this[num];
	}
	return this;
}

//结果是一个dom元素,可以把代码放到Google Chrome下运行
//按F12通过调试命令 console.log() 打印出对象
$("#test1").click(function() {
	$('#show1').append($('#book')[0])
})

$("#test2").click(function() {	
	$('#show2').append($('#book').get(0))
})

$("#test3").click(function() {
	$('#show3').append(aQuery("#book")[0])
})

$("#test4").click(function() {
	$('#show4').append(aQuery("#book").get(0))
})


</script>
</head>

<body>
</body>
</html>